<?php

namespace App\Models\Mgt;

use Illuminate\Database\Eloquent\Model;
use Laracasts\Presenter\PresentableTrait;
use Illuminate\Support\Facades\Config;

//use GeneaLabs\LaravelModelCaching\Traits\Cachable;

class Book extends Model
{
    use PresentableTrait;

    protected $table = 'biz_books';

    protected $presenter = 'App\Http\Presenters\BookPresenter';

    protected $guarded = array();

    //public $timestamps = false;

    /*
        0:未借/1:已借
     */
    const BOOK_STATUS_BORROWED = 1;
    const BOOK_STATUS_UNBORROW = 0;

    public function category()
    {
        return Config::get('params.category');
    }


    public function borrows()
    {
        return $this->hasMany('\App\Models\Biz\Borrow', 'bookid', 'id')->orderBy('date_begin', 'desc');
    }


}

